package com.douyuehan.doubao.redis;

public abstract class BasePrefix implements KeyPrefix {

	private int expireSeconds;  //过期时间

	private String prefix;      //前缀

	public BasePrefix(String prefix){
		this(0, prefix);//默认0代表永不过期
	}

	public BasePrefix(int expireSeconds, String prefix){
		this.expireSeconds = expireSeconds;
		this.prefix = prefix;
	}

	@Override
	public int expireSeconds() {
		return expireSeconds;
	}

	@Override
	public String getPrefix() {
		String className = getClass().getSimpleName();//拿到参数类类名
		return className + ":" + prefix;
	}
}
